package One;
import java.util.Scanner;
public class Main{
	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		while(scan.hasNextInt()){
			int num=scan.nextInt();
			Person[] per=new Person[num];
			for (int i = 0; i < num; i++) {
				per[i]=new Person(scan.next(),scan.nextInt(),scan.nextBoolean());
			}
			for (int k = num-1; k >=0; k--) 
				System.out.println(per[k]);
			Person p =new Person();
			System.out.println(p);
		}
		scan.close();
	}
}